package com.dissertation.respository;

import com.dissertation.model.ScientificProject;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;
import java.util.Optional;

public interface ScientificProjectRepository extends MongoRepository<ScientificProject, String> {

    List<ScientificProject> findByCategoryTreeNameAndCategoryLeafNameAndDeletedIsFalse( String categoryTreeName,
                                                                                        String categoryLeafName );
    List<ScientificProject> findByCategoryTreeNameAndCategoryLeafNameAndDeletedIsFalseAndAuthor(String categoryTreeName,
                                                                                                String categoryLeafName,
                                                                                                String userName);

    Optional<ScientificProject> findByCategoryTreeNameAndCategoryLeafNameAndDeletedIsFalseAndId( String categoryTreeName,
                                                                                                 String categoryLeafName,
                                                                                                 String id );

    List<ScientificProject> findByCategoryTreeNameAndCategoryLeafNameAndDeletedIsFalseAndDateBetween(
            String categoryTreeName,
            String categoryLeafName,
            String begin,
            String end );

}
